Typically, when a computer is powered up or reset, a sequence of events must occur in order for the operating system to "boot" (begin operation). Generally, this sequence of events occurs when a Read Only Memory (ROM) startup program is executed. The ROM startup program determines which, if any, of the attached storage devices contain or contains information sufficient to boot the operating system. For IBM PC type computers, the ROM startup program generally begins by looking to any removable storage media, generally a removable disk. If there are no removable storage media configured for booting the operating system, the ROM startup program checks a fixed storage medium, which is generally a hard-disk. Although other types of storage media are in use, for the purposes of this discussion the storage media will be assumed to be magnetic disks.
Finding a disk which is configured to boot the operating system, the ROM startup program executes a program found at the first physical sectors of the disk. For removable disks, these first sectors make up a boot record. A boot record contains a boot program that loads and executes system files on the disk for booting the operating system. For hard-disks, these first sectors make up a master boot record. The data storage space on hard-disks can generally be divided into partitions, each of which appears to the operating system as a separate disk. In order to support multiple partitions, the master boot record contains a master boot program which determines which partition is to be booted from. Typically, each partition includes a boot record at the first sectors of that partition, and the boot record contains a boot program like that of removable disks. The master boot program transfers control to the boot program contained in the appropriate partition.
There are a variety of file systems in use by different operating systems. Each of these file systems uses a different file system structure to manage data on disks. A file system structure stores information about files on the disk. Sometimes the file system structure is located at the beginning of a disk or partition, and sometimes it is located at various places throughout a disk or partition. The data on disks is generally divided into files, and the information stored in the file system structure generally includes the name and location of each file, in addition to other attributes of the files.
One common type of file system is based on a File Allocation Table (FAT). In such a file system, following the boot record on each disk or partition is a File Allocation Table (FAT). The FAT contains information for every cluster of sectors on the disk or partition, and is used as a map to indicate which clusters contain which computer-readable files. Following the FAT is a directory structure which maps specific file names to corresponding entries in the FAT. In order to locate files on a disk or partition, both the FAT and the directory structure must be intact. When the boot program loads system files to boot the operating system, it relies on the file system structure being intact. In this example, the file system structure would include the FAT and the directory structure. As the operating system is booted, it also relies on the file system structure being intact, in order to find and update files as needed. If the file system structure is damaged, or altered in an unexpected way, the operating system will likely not be able to boot from that disk. In most circumstances, a damaged FAT will result in the loss of at least some, if not all, data on the disk. There are at least three different file systems which utilize the FAT as part of a file system structure: FAT12, FAT16, and FAT32. These file systems correspond to various versions of DOS and Windows operating systems. There are other file systems, such as NTFS (for Windows NT), ODS-2 (for VMS), HPFS (for OS/2) and Ext2fs (for Linux), which use different kinds of file system structures. For example, NTFS uses a Master File Table (MFT), rather than a FAT, to keep track of files. All of these file systems, however, rely on information which constitutes a file system structure.
Many hard disk utility programs make significant modifications to file system structures. For example, a utility which converts a FAT from one format to another must reorganize the information in the FAT, as well as the directory structure. Also, utilities which change the size of partitions on a disk must significantly alter the FAT and directory structure. These operations are generally complicated, and can take a significant amount of time to complete. If there is an unexpected shut-down or reset of the system during any of these procedures, the result is often a file system structure which does not entirely conform to either the pre-modification state or the post-modification state. This resulting state is generally an invalid state. As noted above, this generally results in an unusable file system structure, and a disk which cannot boot. This is also generally accompanied by a loss of data on the disk.
Current file system structure modification programs attempt to reduce the chances of such a catastrophic failure by reducing the amount of time that a file system structure is in an invalid state. However, because some of the operations which must be performed on the file system structure are not atomic operations (which can be executed quickly and do not rely on other procedures), the possibility of a shutdown during one of these operations remains significant. Also, some of the atomic operations are themselves lengthy, and there is a chance of a failure during one of these operations.
What is needed is a method for providing for recovery from a failure of a file system structure modification.